class UserPermissionsController < ApplicationController
  
  # GET /user_permissions
  # GET /user_permissions.xml
  def index
    @user_permissions = UserPermission.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @user_permissions }
    end
  end

  # GET /user_permissions/1
  # GET /user_permissions/1.xml
  def show
    @user_permission = UserPermission.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @user_permission }
    end
  end

  # GET /user_permissions/new
  # GET /user_permissions/new.xml
  def new
    @user_permission = UserPermission.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @user_permission }
    end
  end

  # GET /user_permissions/1/edit
  def edit
    @user_permission = UserPermission.find(params[:id])
  end

  # POST /user_permissions
  # POST /user_permissions.xml
  def create
    @user_permission = UserPermission.new(params[:user_permission])

    respond_to do |format|
      if @user_permission.save
        flash[:notice] = 'UserPermission was successfully created.'
        format.html { redirect_to(@user_permission) }
        format.xml  { render :xml => @user_permission, :status => :created, :location => @user_permission }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @user_permission.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /user_permissions/1
  # PUT /user_permissions/1.xml
  def update
    @user_permission = UserPermission.find(params[:id])

    respond_to do |format|
      if @user_permission.update_attributes(params[:user_permission])
        flash[:notice] = 'UserPermission was successfully updated.'
        format.html { redirect_to(@user_permission) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @user_permission.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /user_permissions/1
  # DELETE /user_permissions/1.xml
  def destroy
    @user_permission = UserPermission.find(params[:id])
    @user_permission.destroy

    respond_to do |format|
      format.html { redirect_to(user_permissions_url) }
      format.xml  { head :ok }
    end
  end
end
